#include <sys/types.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include <net/if_arp.h>		/* For ARPHRD_ETHER */
#include <sys/socket.h>		/* For AF_INET & struct sockaddr */
#include <netinet/in.h>         /* For struct sockaddr_in */
#include <netinet/if_ether.h>

#include <linux/types.h>		/* for "caddr_t" et al		*/
#include <linux/socket.h>		/* for "struct sockaddr" et al	*/
#include <linux/if.h>			/* for IFNAMSIZ and co... */

#include <linux/wireless.h>


int main(int argc,char *argv[]){

	char ifname[32];
	char namebuf[128];
	
	int skfd;
	struct iwreq		wrq;
        
	char *p = NULL;

	skfd = socket(AF_INET, SOCK_DGRAM, 0);
	if(skfd<0)return -1;
	if(argc!=2)
	{
		close(skfd);
		return -1;
	}
	strcpy(ifname,argv[1]);

	memset(namebuf,0,128);

	strncpy(wrq.ifr_name, ifname, IFNAMSIZ);

	//return(ioctl(skfd, request, pwrq));

	if(ioctl(skfd,SIOCGIWNAME, &wrq) < 0){
	    /* If no wireless name : no wireless extensions */
		perror("SIOCGIWNAME");
	    	return(-1);
	}
	else
	{
	      	strncpy(namebuf, wrq.u.name, IFNAMSIZ);
	      	namebuf[IFNAMSIZ] = '\0';
	}
        
	p = strstr(namebuf, "RT73");
	if(p)
		printf("ralink");
	else
		printf("zydas"); 
	
	close(skfd);
}
